package estacioPOO;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.border.EmptyBorder;
import javax.swing.JDesktopPane;
import javax.swing.JInternalFrame;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPanel;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class MenuParaForum extends JFrame {
	private JPanel contentPane;

	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MenuParaForum frame = new MenuParaForum();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	public MenuParaForum() {

		setTitle("Menu Para o Forum Est\u00E1cio");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 800, 600);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);

		JMenuBar meu_menuBar = new JMenuBar();
		contentPane.add(meu_menuBar, BorderLayout.NORTH);

		JMenu mnArquivo = new JMenu("Arquivo");
		meu_menuBar.add(mnArquivo);

		JMenuItem mntmSalvar = new JMenuItem("Salvar");
		mntmSalvar.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				JDesktopPane dkPane = new JDesktopPane();
				JInternalFrame intFrame = new JInternalFrame();
				intFrame.setSize(300, 300);
				intFrame.setResizable(true);
				intFrame.setClosable(true);
				intFrame.setTitle("Minha janela interna");
				intFrame.setVisible(true);
				dkPane.add(intFrame);
				getContentPane().add(dkPane);

			}
		});
		mnArquivo.add(mntmSalvar);

		JMenuItem mntmFechar = new JMenuItem("Fechar");
		mnArquivo.add(mntmFechar);

		JMenu mnNewMenu = new JMenu("Editar");
		meu_menuBar.add(mnNewMenu);

		JMenuItem mntmCopiar = new JMenuItem("Copiar");
		mnNewMenu.add(mntmCopiar);

		JMenuItem mntmColar = new JMenuItem("Colar");
		mnNewMenu.add(mntmColar);

		JMenu mnSair = new JMenu("Sair");
		meu_menuBar.add(mnSair);
	}

}
